home *** CD-ROM | disk | FTP | other *** search
- #ifndef FWARSTAT_H
- #define FWARSTAT_H
- //========================================================================================
- //
- // File: FWArStat.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWARDYNA_H
- #include "FWArDyna.h"
- #endif
-
-
- //========================================================================================
- // CLASS FW_TStaticArchiver
- //========================================================================================
-
- template <class tType>
- class FW_TStaticArchiver
- {
-
- public:
-
- // ----- Call these methods to archive objects by reference.
-
- static tType* ReadStaticObject(FW_CReadableArchive& readableArchive);
- // Constructs an object of type tType.
- // The archive's object registry is used.
- // The runtime type is assumed to be tType!
-
- static void WriteStaticObject(FW_CWritableArchive& writableArchive,
- const tType* object);
- // Write the construction information out to an archive.
- // The archive's object registry is used.
- // The runtime type is assumed to be tType!
-
-
- // ----- Create specializations of these methods to archive objects by reference.
-
- static tType* DoReadObject(FW_CReadableArchive& readableArchive);
- // The user must make a specialization of this function.
-
- static void DoWriteObject(FW_CWritableArchive& writableArchive,
- const tType* object);
- // The user must make a specialization of this function.
- };
-
-
- //----------------------------------------------------------------------------------------
- // FW_TStaticArchiver<tType>::ReadStaticObject
- //----------------------------------------------------------------------------------------
-
- template <class tType>
- inline tType* FW_TStaticArchiver<tType>::ReadStaticObject(FW_CReadableArchive& readableArchive)
- {
- return (tType *)readableArchive.InputObject((FW_CReadableArchive::InputFunction)DoReadObject);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_TStaticArchiver<tType>::WriteStaticObject
- //----------------------------------------------------------------------------------------
-
- template <class tType>
- inline void FW_TStaticArchiver<tType>::WriteStaticObject(FW_CWritableArchive& writableArchive,
- const tType* object)
- {
- writableArchive.OutputObject((FW_CWritableArchive::OutputFunction)DoWriteObject, (const void*)object);
- }
-
- #endif